import Vue from 'vue'
import Router from 'vue-router'
const Login = r => require.ensure([], () => r(require('@/views/login')), 'Login')
const Homepage = r => require.ensure([], () => r(require('@/views/homepage')), 'Homepage')
const waitPort = r => require.ensure([], () => r(require('@/views/waitPort')), 'waitPort')
const kidney = r => require.ensure([], () => r(require('@/views/kidneyMatch')), 'kidney')
const donatorDetail = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/donatorDetail')), 'donatorDetail')
const operationInfo = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/operationInfo'), 'operationInfo'))
const matchList = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/matchList'), 'matchList'))
const waitMatch = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/waitMatch'), 'waitMatch'))
const HLAMatch = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/HLAMatch'), 'HLAMatch'))
const chooseMatch = r => require.ensure([], () => r(require('@/views/kidneyMatch/children/chooseMatch'), 'chooseMatch'))

const addpatients = r =>require.ensure([], () =>(require('@/views/waitPort/children/addpatients')), 'addpatients')
const waithome = r => require.ensure([], () => r(require('@/views/waitPort/children/home')), 'waithome')
const confirmadd = r => require.ensure([], () => r(require('@/views/waitPort/children/confirmAdd')), 'confirmadd')
const patientDetails=r=>require.ensure([],()=>r(require('@/views/waitPort/children/patients-details')),'patientDetails')
const manualAdd = r => require.ensure([], () => r(require('@/views/waitPort/children/manualAdd')), 'manualAdd')

Vue.use(Router)

export default new Router({
	routes: [{//登陆
		path: '/',
		name: 'Login',
		component: Login
	},
	{
		path: '/patientDetails',
		component: patientDetails
	},
	{//主页
		path: '/homepage',
		name: '',
		component: Homepage,
		children: [{//等待移植
			path: '/waitPort',
			name: 'waitPort',
			component: waitPort,	
		},
		{
			path:'/waitPort/addPatients',
			name: 'addpatients',
			component: addpatients
		},
		{
			path: "/waitPort/addPatients/confirmadd",
			component: confirmadd
		},
		{
			path:'/waitPort/addPatients/manualAdd',
			component:manualAdd
		},
		{//肾源配型
			path: '/kidney',
			name: 'kidney',
			component: kidney
		},{//供体详情
			path: '/kidney/donatorDetail',
			name: 'donatorDetail',
			component: donatorDetail
		},{//编辑手术信息
			path: '/kidney/operationInfo',
			name: 'operationInfo',
			component: operationInfo
		},{//待配型患者-候选
			path: '/kidney/matchList',
			name: 'matchList',
			component: matchList
		},{//等待配型
			path: '/kidney/waitMatch',
			name: 'waitMatch',
			component: waitMatch
		},{//HLA配型
			path: '/kidney/HLAMatch/:type',
			name: 'HLAMatch',
			component: HLAMatch
		},{//选择配型患者
			path: '/kidney/chooseMatch/:type',
			name: 'chooseMatch',
			component: chooseMatch
		}]
	}]
})
